#ifndef ICGOBJECT_H
#define ICGOBJECT_H

#include <vector>
#include "point.h"
#include "ray.h"
#include "matrix.h"
#include "types.h"
#include "cgmaterial.h"

class ICgObject
{
public:
    virtual ~ICgObject();
    virtual bool intersect(const Ray &r, double &t, Vector &normal) const = 0;
    virtual void openGlRender() const = 0;
    virtual ICgObject* clone() const = 0;
    void multiplyCurrentTransformation(const Matrix &m);
    void applyCurrentTransformation();

    CgMaterial material() const { return material_; }
    void set_material(const CgMaterial &material) { material_ = material; }
    Matrix transformation() const { return transformation_; }
protected:
    std::vector<Point*> vertices_;
    std::vector<Edge*> edges_;
    std::vector<Face> faces_;
    CgMaterial material_;
    Matrix transformation_;

    ICgObject();
    void setup_gl_materials() const;
};

#endif // ICGOBJECT_H
